Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for DROP IF EXISTS clause #115

Merged
merged 5 commits into from
Jul 10, 2023
Merged

Conversation

taka-oyama
Copy link
Collaborator

Fix: #111

Checklist

  • CHANGELOG

@taka-oyama taka-oyama added the enhancement New feature or request label Jun 20, 2023
@taka-oyama taka-oyama added this to the 5.2 milestone Jun 20, 2023
@taka-oyama taka-oyama self-assigned this Jun 20, 2023
@taka-oyama taka-oyama changed the base branch from master to 5.x June 20, 2023 06:58
tests/Schema/BlueprintTest.php Outdated Show resolved Hide resolved
@tyabu12
Copy link
Contributor

tyabu12 commented Jun 23, 2023

test_dropIfExists is failed. Could you fix it?

There was 1 error:

1) Colopl\Spanner\Tests\Schema\BlueprintTest::test_dropIfExists
Google\Cloud\Core\Exception\BadRequestException: {
    "message": "Error parsing Spanner DDL statement: drop table if exists `Test3` : Syntax error on line 1, column 12: Encountered 'if' while parsing: identifier",
    "code": 3,
    "status": "INVALID_ARGUMENT",
    "details": [
        {
            "@type": "grpc-status-details-bin",
            "data": "<Unknown Binary Data>"
        }
    ]
}

/project/vendor/google/cloud-core/src/GrpcRequestWrapper.php:263
/project/vendor/google/cloud-core/src/GrpcRequestWrapper.php:151
/project/vendor/google/cloud-core/src/GrpcTrait.php:82
/project/vendor/google/cloud-spanner/src/Connection/Grpc.php:691
/project/vendor/google/cloud-spanner/src/Database.php:517
/project/src/Concerns/ManagesDataDefinitions.php:62
/project/src/Connection.php:306
/project/tests/Schema/BlueprintTest.php:94

ERRORS!
Tests: 108, Assertions: 374, Errors: 1, Skipped: 2.

According to the documentation, the DROP TABLE IF EXISTS is supported, but the PHP library may not yet support it.

https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#drop_table

@taka-oyama
Copy link
Collaborator Author

Waiting for emulator to add support.

GoogleCloudPlatform/cloud-spanner-emulator#119

@taka-oyama taka-oyama changed the title feat: add support for DROP IF EXISTS clause Draft: feat: add support for DROP IF EXISTS clause Jun 23, 2023
@taka-oyama
Copy link
Collaborator Author

I've changed the title to DRAFT

@taka-oyama taka-oyama marked this pull request as draft June 23, 2023 03:19
@taka-oyama taka-oyama marked this pull request as ready for review July 7, 2023 08:53
@taka-oyama taka-oyama changed the title Draft: feat: add support for DROP IF EXISTS clause feat: add support for DROP IF EXISTS clause Jul 7, 2023
@taka-oyama
Copy link
Collaborator Author

Emulator added support and tests are now passing.

https://github.com/GoogleCloudPlatform/cloud-spanner-emulator/releases/tag/v1.5.7

@taka-oyama taka-oyama merged commit 5428eec into 5.x Jul 10, 2023
2 checks passed
@taka-oyama taka-oyama deleted the feature/drop-if-exists branch July 10, 2023 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for DROP IF EXISTS
3 participants